package com.yt.service.impl;
import com.yt.service.MessageSend;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;

import javax.annotation.Resource;

@EnableBinding(Source.class)
public class MessageSendImpl implements MessageSend {
    @Resource
    @Output(Source.OUTPUT)
    MessageChannel out;
    @Override
    public void send(String message) {
        out.send(MessageBuilder.withPayload(message).build());
    }
}
